package com.hihiwjc.app.zzmh.apis;

import com.hihiwjc.app.zzmh.apis.home.HomeApi;
import com.lidroid.xutils.HttpUtils;

/**
 * 客户端Api
 * <br/>Created by hihiwjc on 2015/10/28 0028
 * <br/>Author:hihiwjc
 * <br/>Email:hihiwjc@live.com
 */

public final class Apis {

    /**
     * 服务器地址
     */
    private static final String SERVER_URL = "http://api.zhuizhuiyoyo.com";
    /**
     * 服务请求地址
     */
    private static final String REQ_URL = "/request.php?method=";
    /**
     * API地址
     */
    public static final String API_URL = SERVER_URL + REQ_URL;
    /**
     * API字符集
     */
    public static final String API_CHARSET = "UTF-8";

    private static Apis self;
    private final static int CONN_TIMEOUT = 6000;
    private HttpUtils mHttpUtils;

    private Apis() {
    }

    public static Apis get() {
        if (self == null) {
            self = new Apis();
            self.init();
        }
        return self;
    }

    /**
     * 初始化客户端Apis
     */
    private void init() {
        mHttpUtils = new HttpUtils(CONN_TIMEOUT);
    }

    /**
     * 获取首页Apis
     *
     * @return 首页Apis
     */
    public HomeApi home(ApiCallback apiCallback) {
        return new HomeApi(mHttpUtils,apiCallback);
    }
}
